package com.sch.www.oauth.services.impl;

import com.sch.www.common.base.BaseServicesSimpleImp;
import com.sch.www.oauth.orm.dao.manual.ClientMapper;
import com.sch.www.oauth.orm.entity.manual.Client;
import com.sch.www.oauth.orm.entity.manual.ClientExample;
import com.sch.www.oauth.services.ClientServices;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class ClientServicesImpl extends BaseServicesSimpleImp<Client, ClientExample,ClientMapper,ClientServices> implements ClientServices {
    @Override
    protected String getTableName() {
        return null;
    }

    @Override
    protected ClientExample getExampleNewInstance() {
        return new ClientExample();
    }

    @Override
    public Client selectByClientId(String clientId) {
        if (StringUtils.isBlank(clientId)) {
            return null;
        } else {
            ClientExample clientExample = getExampleNewInstance();
            clientExample.createCriteria().andClientIdEqualTo(clientId);
            return getMapper().selectOneByExample(clientExample);
        }
    }
}
